fix(renderer): guard malformed part render in flush#347
Merged
sudo-tee merged 4 commits intosudo-tee:refactor/renderer-componentsfrom Apr 7, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR hardens the Neovim output renderer against malformed tool parts by preventing formatter.format_part errors from crashing a flush, and adds a replay regression test driven by a real malformed todowrite payload fixture.
Changes:
- Guard
formatter.format_partwithpcallduring flush and skip malformed parts while emitting a warning. - Add a replay test that renders a recorded malformed
todowritesession without crashing. - Add a JSON fixture containing a real malformed
todowritetool call (todosencoded as a string instead of an array).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
lua/opencode/ui/renderer/flush.lua |
Wraps part formatting in pcall and warns once instead of crashing the renderer flush. |
tests/replay/todowrite_malformed_session_spec.lua |
Adds a regression spec that replays malformed session data and asserts the renderer doesn’t crash. |
tests/data/todowrite-malformed-session.json |
Adds a real-world session fixture containing the malformed todowrite payload. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
74a74bc
into
sudo-tee:refactor/renderer-components
5 checks passed
Owner
|
Thanks for this fix |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This seems to be the simplest fix